package com.gooluke.service.impl;

import com.gooluke.dao.UserInfoDao;
import com.gooluke.dao.UserInfoDao2;
import com.gooluke.entity.TUserInfo;
import com.gooluke.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author gooluke
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserInfoDao userInfoDao;

    @Autowired
    private UserInfoDao2 userInfoDao2;

    /**
     * 在这里没有设置数据源，dao层设置了数据源，可以自动切换
     */
    @Override
    public List<TUserInfo> selectList() {
        List<TUserInfo> tUserInfos = userInfoDao.selectUserList(new TUserInfo());
        tUserInfos.forEach(System.out::println);
        List<TUserInfo> tUserInfos2 = userInfoDao2.selectUserList(new TUserInfo());
        tUserInfos2.forEach(System.out::println);
        tUserInfos.addAll(tUserInfos2);
        return tUserInfos;
    }

}
